


class WashMaachine {
    public String brand; // 品牌
    public String type; // 型号
    public double weight; // 重量
    public double length; // 长
    public double width; // 宽
    public double height; // 高
    public String color; // 颜色

    public void washClothes(){ // 洗衣服
        System.out.println("洗衣功能");
    }
    public void dryClothes(){ // 脱水
        System.out.println("脱水功能");
    }
    public void setTime(){ // 定时
        System.out.println("定时功能");
    }
}

class Phone {
    public String brand; // 品牌
    public String type; // 型号
    public double weight; // 重量
    public double length; // 长
    public double width; // 宽
    public double height; // 高
    public String color; // 颜色
    public String screen;//屏幕
    //.........

    public void moving() {
        System.out.println("看电影");
    }
    public void call() {
        System.out.println("打电话");
    }
}
class Person { //类
    //属性/成员变量
    public String name;//没有赋值 默认为null
    public int age;
    //行为/成员方法
    public void eat() {
        System.out.println("吃饭");
    }
    public void sleep() {
        System.out.println(name+"睡觉");
    }
}

public class Java8_1 {

    public static void main(String[] args) {
        Person[] person1 = new Person[3];//定义数组
    }

    public static void main3(String[] args) {
        String s = null;
        System.out.println(s.length());
        String str = new String("hello");
        String str2 = "hello";
    }

    public static void main2(String[] args) {
        //一个类可以实例化多个对象，通过关键字new
        Person person1 = new Person();
        person1.age = 10;

        person1.sleep();
        person1.name = "张三";//null
        System.out.println(person1.name+" "+person1.age);

        Person person2 = new Person();
        person2.age = 20;
        person2.name = "李四";
        person2.sleep();
        System.out.println(person2.name+" "+person2.age);
    }

    public static void main1(String[] args) {
        //通过关键字new 实例化对象
        Phone phone = new Phone();
        Person person = new Person();
        WashMaachine washMaachine = new WashMaachine();
    }

}
